#ifndef _TTY_LDISC_H
#define _TTY_LDISC_H 

#include <tty.h>

#define LDISCS_NR	(3)

struct tty;

struct tty_ldisc_ops {   
    int  (*open)(struct tty *tdev);
    void (*close)(struct tty *tdev);
    int  (*read)(struct tty *tdev, unsigned char *buf, unsigned int count);
    int  (*write)(struct tty *tdev, const unsigned char *buf, unsigned int count);
    int  (*ioctl)(struct tty *tdev, unsigned int cmd, unsigned int arg);
    void (*flush)(struct tty *tdev);
    void (*receive)(struct tty *tdev, const unsigned char *cp, const unsigned char *fp, unsigned int count); 
};

struct tty_ldisc {       
    struct tty_ldisc_ops ops;
}; 

int tty_register_ldisc(unsigned int disc, struct tty_ldisc *new_ldisc);
int tty_set_ldisc(struct tty *tdev, int ldisc);
struct tty_ldisc *tty_ldisc_get(struct tty *tdev);
int tty_ldisc_open(struct tty *tdev);
void tty_ldisc_close(struct tty *tdev);

#endif /* _TTY_LDISC_H */

